extends Node2D

var ANIM_TICK = 0.15

var base_pos
var base_scale

func _ready():
	base_pos = position
	base_scale = scale
	remove_focus()

# 当这个deck的player没有被选中时，放置到背景层
func remove_focus():
	var tween = get_tree().create_tween()
	tween.parallel().tween_property(self, "scale", Vector2(0.8 * base_scale.x, 0.8 * base_scale.y), ANIM_TICK)
	tween.parallel().tween_property(self, "position", Vector2(base_pos.x, base_pos.y - 150), ANIM_TICK)
	tween.parallel().tween_property(self, "material:shader_parameter/brightness", 0.5, ANIM_TICK)
	z_index = 0

# 当这个deck的player被选中时，放置到前景层
func get_focus():
	z_index = 1
	var tween = get_tree().create_tween()
	tween.parallel().tween_property(self, "scale", base_scale, ANIM_TICK)
	tween.parallel().tween_property(self, "position", base_pos, ANIM_TICK)
	tween.parallel().tween_property(self, "material:shader_parameter/brightness", 1, ANIM_TICK)
	
